package com.example.controller;

import com.example.pojo.Account;
import com.example.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@ResponseBody
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping("/queryAll")
    @ResponseBody
    public List<Account> queryAll() throws Exception {
        return demoService.listAccount();
    }

    @RequestMapping("/findMap")
    @ResponseBody
    public Map<String, Account> findMap() throws Exception {
        Map<String, Account> map = demoService.findMap();
        System.out.println(map);
        return map;
    }

}
